// function T(arg){
//     this.a = arg; 
//     return this
// } 
// var b = T(3); 

// var a = T(2); 
// console.log(a.a);
// console.log(b.a)

// var c = Symbol('key')
// var d = Symbol('key')
// console.log(c)
// console.log(c == d)
// console.log(c === d)

function A(){

}
A.prototype.logB = function() {console.log('b')}
function B(){}
var e = new B()
var f = new A()
f.logB()
//e.logB()

// f -----> F.prototype -----> Object.prototype -----> null
// F -----> Function.prototype -----> Object.prototype -----> null
console.log(B.prototype.prototype)
console.log(B.prototype.constructor == B)
console.log(e._proto_ == B.prototype)
{/* <style>
    diplay: flex;
    flex-wrap: wrap;
    justify-center: center
</style> */}

var a = []
a[10] = 10
console.log(a)
console.log(a[10])
console.log(a[11])
a.map(item => {console.log('1');console.log(item)})

this.r = 1 // window.r
function T(arg) {
    console.log(this.r)
    this.r = arg
    console.log(this.r)
}
T(2)
T(3) //global.T   
// node undefined 2 2 3
//浏览器 1 2 2 3

function foo(a,b){
    arguments[1]=2;
    console.log(arguments[1]);
    console.log(arguments[1] == b)
    console.log(arguments[1] === b)
    console.log(b);
}
foo(1);
foo(1, undefined)

var arr = [];arr.a = 3 // arr [a: 3]
arr[0] = 1 // arr [1, a:3] arr[1] == undefined 不是 a: 3
// 函数的arguments属性被废弃，但是函数内部可以使用arguments对象


var bf = foo.bind({})

console.log(foo)
console.log(bf)
console.log(bf == foo)
bf(1)


const bar = {
    a: 1
}
function ts() {
    console.log(this)
    console.log(this === bar)
}
var bts = ts.bind({b: 1})
ts.apply(bar) // true
bts.apply(bar) //false   bts属于新绑定函数，具有boundthis这个属性，使用其作为传递给this的值，不会因为apply(bar)将this改变为bar，此时this还是指向boundthis => {b: 1}
bts.call(bar)
let jj = bts.bind(bar)
console.log(jj)


jj.apply(bar)


var obj = {
    a: function() {
        console.log('a')
    },
    b: function() {
        console.log('b')
    }
}
// obj.a().b()
console.log(foo.bind.apply)
console.log(foo.apply.bind)